package jdbc;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class jdbcTest {

  private static String DRIVER = "com.mysql.jdbc.Driver";
  private static String URL = "jdbc:mysql://172.16.10.65:3306/pingxin_irs_db";
  private static String USERNAME = "root";
  private static String PASSWORD = "password_pinglian";

  public static void main(String[] args) {
    Connection con = null;
    Statement stat = null;
    ResultSet rs = null;
    int count = 1;
    try {
      Class.forName(DRIVER);
      con = DriverManager.getConnection(URL, USERNAME, PASSWORD);
      stat = con.createStatement();
      String sql = "select * from user limit 14000,100";
      rs = stat.executeQuery(sql);
      while (rs.next()) {
        System.out.println(count + " : " + rs.getString(4));
        ++count;
      }
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      try {
        rs.close();
        stat.close();
        con.close();
      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
  }

}
